import config from './request/config.js';

export default function cUpload(tempFilePath = '') {
	const token = uni.getStorageSync('token');
	return new Promise((resolve) => {
		uni.uploadFile({
			// url: 'https://d-zhzh.bigchun.com/api/common/upload',
			url: 'https://d-freesingleking.bigchun.com/api/common/upload',
			filePath: tempFilePath,
			name: 'file',
			formData: {
				file: tempFilePath,
				token: token
			},
			header: {
				'Content-Type': 'multipart/form-data',
				token: token
			},
			success({
				data
			}) {
				resolve(JSON.parse(data));
			}
		});
	});
}
